import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { AccountBookOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

const routeName = 'billing';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/billing',
    name: routeName,
    redirect: '/billing/records',
    component: Layout,
    meta: {
      title: '账单中心',
      icon: renderIcon(AccountBookOutlined),
      permissions: ['billing_records', 'billing_transfer', 'billing_change', 'billing_bank'],
      sort: 1,
    },
    children: [
      {
        path: 'records',
        name: `${routeName}_records`,
        meta: {
          title: '账单记录',
          permissions: ['billing_records'],
        },
        component: () => import('@/views/billing/records/index.vue'),
      },
      {
        path: 'transfer',
        name: `${routeName}_transfer`,
        meta: {
          title: '转账记录',
          permissions: ['billing_transfer'],
        },
        component: () => import('@/views/billing/transfer/index.vue'),
      },
      {
        path: 'change',
        name: `${routeName}_change`,
        meta: {
          title: '账变记录',
          permissions: ['billing_change'],
        },
        component: () => import('@/views/billing/change/index.vue'),
      },
      {
        path: 'bank',
        name: `${routeName}_bank`,
        meta: {
          title: '回款记录',
          permissions: ['billing_bank'],
        },
        component: () => import('@/views/billing/bank/index.vue'),
      },
    ],
  },
];

export default routes;